package Acm;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class AGamewithMultisetOther {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int maxn = 200007;
        long[] a = new long[maxn];
        long[] sum = new long[maxn];
        int n = sc.nextInt();
        Map<Long, Long> mp = new HashMap<>();
        for (int i = 0; i < n; i++) {
            long op = sc.nextLong();
            long u = sc.nextLong();
            if (op == 1) {
                if (mp.containsKey(u)) {
                    mp.put(u, mp.get(u) + 1);
                } else {
                    mp.put(u, 1L);
                }
            }
            if (op == 2) {
                if (u == 0) {
                    System.out.println("YES");
                    continue;
                }
                for (long j = 30; j >= 0; j--) {
                    if (u >= (1 << j)) {
                        long res = u / (1 << j);
                        long tmp = mp.getOrDefault(j, 0L);
                        u -= Math.min(res, tmp) * (1 << j);
                    }
                }
                if (u == 0) {
                    System.out.println("YES");
                    continue;
                }
                System.out.println("NO");
            }
        }
    }
}
